﻿<!--http://www.csstablegenerator.com/?table_id=3-->
@model JewererBasic.Classes.Process_Report_View
<h2>Process Report</h2>
<p>
    <strong>Reporter: </strong>
    @Html.DisplayFor(m => m.Reporter)
</p>
<p>
    <strong>Report Time: </strong>
    @Html.DisplayFor(m => m.Report_Time)
</p>
<p>
    <strong>Total Component Bag:</strong>
    @Html.DisplayFor(m => m.Total_Bag_Component)
</p>
<p>
    <strong>Total Stone Bag:</strong>
    @Html.DisplayFor(m => m.Total_Bag_Stone)
</p>
<p>
    <strong >Details: </strong>
</p>
<strong>Show Component/Stone: </strong>
<input type="checkbox" id="toggle" />
@if (Model.Processes != null)
{            
    <!--Component--> 
    foreach (var item in @Model.Processes)
    {
        if(item.Total_Bag_Component>0){
            <table class="myTable component_report_table">    
                <tr>
                    <td>
                        Process Name
                    </td>                    
                    <td>
                        Total Bag
                    </td>                   
                </tr>  
                <tr>
                    <!--Process Step Infor-->
                    <td>
                        @Html.DisplayName(item.Process_Name)
                    </td>
                    <td>
                        @Html.DisplayName(item.Total_Bag_Component.ToString())
                    </td>                               
                                       
                    <td>
                        <!--Component-->
                        @if (item.Components != null && item.Components.Count > 0)
                        {
                            <!--Order-->                            
                            foreach (var component in item.Components)
                            {
                                <table class="myTable">
                                    <tr style="border:solid; border-color:black; border-width: thin;">
                                        <td>
                                            Component Id
                                        </td>                                                   
                                        <td>
                                            Weight
                                        </td>                 
                                    </tr>
		                            <tr style="border:solid; border-color:black; border-width: thin;">
                                        <td>
                                            @Html.DisplayName(component.Id)
                                        </td>                                       
                                        <td>
                                            @Html.DisplayName(component.Total_Weight.ToString())
                                        </td>
                                        <td>
                                            @if (component.Orders != null && component.Orders.Count > 0)
                                            {
                                                <table class="myTable">
                                                    <tr style="border:solid; border-color:black; border-width: thin;">
                                                        <td>
                                                            Order Id
                                                        </td>
                                                        <td>
                                                            Total Bag
                                                        </td>                                                   
                                                    </tr>                                                
                                                    @foreach (var order in component.Orders)
                                                    {
                                                        <tr style="border:solid; border-color:black; border-width: thin;">
                                                            <td>
                                                                @Html.DisplayName(order.Order_Id)
                                                            </td>
                                                            <td>
                                                                @Html.DisplayName(order.Total_Bag.ToString())
                                                            </td>
                                                            <td>
                                                                @if (order.Products != null && order.Products.Count > 0)
                                                                {
                                                                    <table class="myTable">
                                                                        <tr style="border:solid; border-color:black; border-width: thin;">
                                                                            <td>
                                                                                Product Id
                                                                            </td>
                                                                            <td>
                                                                                Product Qty
                                                                            </td>
                                                                            <td>
                                                                                Total Bag
                                                                            </td>                                                                    
                                                                        </tr>
                                                                        @foreach (var product in order.Products)
                                                                        {
                                                                            <tr style="border:solid; border-color:black; border-width: thin;">
                                                                                <td>
                                                                                    @Html.DisplayName(product.Product_Name)
                                                                                </td>
                                                                                <td>
                                                                                    @Html.DisplayName(product.Product_Qty.ToString())
                                                                                </td>
                                                                                <td>
                                                                                    @Html.DisplayName(product.Bags.Count.ToString())
                                                                                </td>
                                                                                <td>
                                                                                    @if (product.Bags != null && product.Bags.Count > 0)
                                                                                    {
                                                                                        <table class="myTable">
                                                                                            <tr style="border:solid; border-color:black; border-width: thin;">
                                                                                                <td>
                                                                                                    Bag Id
                                                                                                </td>
                                                                                                <td>
                                                                                                    Qty
                                                                                                </td>
                                                                                                <td>
                                                                                                    Finish Week
                                                                                                </td>                                                                                              
                                                                                                <td>
                                                                                                    Component Weight
                                                                                                </td>
                                                                                            </tr>
                                                                                            @foreach (var bag in product.Bags)
                                                                                            {
                                                                                                <tr style="border:solid; border-color:black; border-width: thin;">
                                                                                                    <td>
                                                                                                        @Html.DisplayName(bag.Bag_Id)
                                                                                                    </td>
                                                                                                    <td>
                                                                                                        @Html.DisplayName(bag.Product_Qty.ToString())
                                                                                                    </td>
                                                                                                    <td>
                                                                                                        @Html.DisplayName(bag.Finish_Week.ToString())
                                                                                                    </td>                                                                                                   
                                                                                                    <td>
                                                                                                        @Html.DisplayName(bag.Component_Weight.ToString())
                                                                                                    </td>
                                                                                                </tr>
                                                                                            }
                                                                                        </table>
                                                                                    }
                                                                                </td>
                                                                            </tr>    
                                                                        }
                                                                    </table>
                                                                }
                                                            </td>
                                                        </tr>
                                                    }
                                            </table>
                                            }
                                        </td>
		                            </tr>
                                </table>
                            }
                        }
                    </td>
                </tr>
            </table>
        }
    }
        
    <!--Stone-->
    foreach (var item in @Model.Processes)
    {
        if(item.Total_Bag_Stone>0){
            <table class="myTable stone_report_table">    
            <tr>
                <td>
                    Process Name
                </td>                    
                <td>
                    Total Bag
                </td>                   
            </tr>  
            <tr>
                <!--Process Step Infor-->
                <td>
                    @Html.DisplayName(item.Process_Name)
                </td>                   
                <td>
                    @Html.DisplayName(item.Total_Bag_Stone.ToString())
                </td>
                   
                <td>
                    <!--Stone-->
                    @if (item.Stones != null && item.Stones.Count > 0)
                    {
                        <!--Order-->                            
                        foreach (var stone in item.Stones)
                        {
                            <table class="myTable">
                                <tr style="border:solid; border-color:black; border-width: thin;">
                                    <td>
                                        Stone Id
                                    </td>           
                                    <td>
                                        Qty
                                    </td>  
                                    <td>
                                        Weight
                                    </td>                 
                                </tr>
		                        <tr style="border:solid; border-color:black; border-width: thin;">
                                    <td>
                                        @Html.DisplayName(stone.Id)
                                    </td>
                                    <td>
                                        @Html.DisplayName(stone.Total_Qty.ToString())
                                    </td>
                                    <td>
                                        @Html.DisplayName(stone.Total_Weight.ToString())
                                    </td>
                                    <td>
                                        @if (stone.Orders != null && stone.Orders.Count > 0)
                                        {
                                            <table class="myTable">
                                                <tr style="border:solid; border-color:black; border-width: thin;">
                                                    <td>
                                                        Order Id
                                                    </td>
                                                    <td>
                                                        Total Bag
                                                    </td>                                                   
                                                </tr>                                                
                                                @foreach (var order in stone.Orders)
                                                {
                                                    <tr style="border:solid; border-color:black; border-width: thin;">
                                                        <td>
                                                            @Html.DisplayName(order.Order_Id)
                                                        </td>
                                                        <td>
                                                            @Html.DisplayName(order.Total_Bag.ToString())
                                                        </td>
                                                        <td>
                                                            @if (order.Products != null && order.Products.Count > 0)
                                                            {
                                                                <table class="myTable">
                                                                    <tr style="border:solid; border-color:black; border-width: thin;">
                                                                        <td>
                                                                            Product Id
                                                                        </td>
                                                                        <td>
                                                                            Product Qty
                                                                        </td>
                                                                        <td>
                                                                            Total Bag
                                                                        </td>                                                                    
                                                                    </tr>
                                                                    @foreach (var product in order.Products)
                                                                    {
                                                                        <tr style="border:solid; border-color:black; border-width: thin;">
                                                                            <td>
                                                                                @Html.DisplayName(product.Product_Name)
                                                                            </td>
                                                                            <td>
                                                                                @Html.DisplayName(product.Product_Qty.ToString())
                                                                            </td>
                                                                            <td>
                                                                                @Html.DisplayName(product.Bags.Count.ToString())
                                                                            </td>
                                                                            <td>
                                                                                @if (product.Bags != null && product.Bags.Count > 0)
                                                                                {
                                                                                    <table class="myTable">
                                                                                        <tr style="border:solid; border-color:black; border-width: thin;">
                                                                                            <td>
                                                                                                Bag Id
                                                                                            </td>
                                                                                            <td>
                                                                                                Qty
                                                                                            </td>
                                                                                            <td>
                                                                                                Finish Week
                                                                                            </td>
                                                                                            <td>
                                                                                                Stone Qty
                                                                                            </td>
                                                                                            <td>
                                                                                                Stone Weight
                                                                                            </td>
                                                                                        </tr>
                                                                                        @foreach (var bag in product.Bags)
                                                                                        {
                                                                                            <tr style="border:solid; border-color:black; border-width: thin;">
                                                                                                <td>
                                                                                                    @Html.DisplayName(bag.Bag_Id)
                                                                                                </td>
                                                                                                <td>
                                                                                                    @Html.DisplayName(bag.Product_Qty.ToString())
                                                                                                </td>
                                                                                                <td>
                                                                                                    @Html.DisplayName(bag.Finish_Week.ToString())
                                                                                                </td>
                                                                                                <td>
                                                                                                    @Html.DisplayName(bag.Stone_Qty.ToString())
                                                                                                </td>
                                                                                                <td>
                                                                                                    @Html.DisplayName(bag.Stone_Weight.ToString())
                                                                                                </td>
                                                                                            </tr>
                                                                                        }
                                                                                    </table>
                                                                                }
                                                                            </td>
                                                                        </tr>    
                                                                    }
                                                                </table>
                                                            }
                                                        </td>
                                                    </tr>
                                                }
                                        </table>
                                        }
                                    </td>
		                        </tr>
                            </table>
                        }
                    }
                </td>
            </tr>
        </table>
        }
    }
}
@section Scripts {    
    <script type="text/javascript">
        $(document).ready(function () {
            $('.stone_report_table').hide();
        });
        $('#toggle').click(function () {
            if (this.checked) {
                $('.component_report_table').hide();
                $('.stone_report_table').show();
            }else{
                $('.component_report_table').show();
                $('.stone_report_table').hide();
            }
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            $("form").submit(function (evt) {

            });
        });
    </script>
}

